package spe.ui.wizard;

import java.util.List;

import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.Separator;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.BaseNewWizardMenu;

/**
 * @author: Dao Anh Vu - May 28, 2012
 * @description:
 * 		This class populates "New" menu item that configured under
 * 		org.eclipse.ui.newWizard. See plugin.xml for more information
 * */

public class NewWizardMenu extends BaseNewWizardMenu 
{
	private static int Number_Of_Config_Item = 3;

	public NewWizardMenu(IWorkbenchWindow window, String id)
	{
		super(window, id);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	protected void addItems(@SuppressWarnings("rawtypes") List listWizards)
	{
		if(addShortcuts(listWizards))
		{
			if(listWizards.size() > Number_Of_Config_Item)
				listWizards.add(Number_Of_Config_Item, new Separator());
			listWizards.add(new Separator());
		}
		
		//add "Other..." action to show the new wizard dialog
		listWizards.add(new ActionContributionItem(this.getShowDialogAction()));
	}

}
